---
layout: m1x_soap
title: Country List
---

<h2><a name="directory_country.list-CountryAPI"></a>Country API</h2>

<p>Allows you to retrieve the list of countries from Magento.</p>

<p><b>Module: Mage_Directory</b></p>

<p><b>Resource: directory_country</b></p>

<p><b>Aliases</b>:</p>
<ul>
	<li>country</li>
</ul>


<h4><a name="directory_country.list-Method%3A"></a>Method:</h4>

<ul>
	<li>directory_country.list (SOAP V1)</li>
	<li>directoryCountryList (SOAP V2)</li>
</ul>


<p>Retrieve the list of countries from Magento.</p>

<p><b>Aliases</b>:</p>
<ul>
	<li>country.list</li>
</ul>


<h5><a name="directory_country.list-Arguments%3A"></a>Arguments:</h5>


<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> sessionId </td>
<td> Session ID </td>
</tr>
</tbody></table>


<h5><a name="directory_country.list-Returns%3A"></a>Returns:</h5>


<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> array </td>
<td> countries </td>
<td> An array of directoryCountryEntity </td>
</tr>
</tbody></table>


<p>The <b>directoryCountryEntity</b> content is as follows:</p>

<table><tbody>
<tr>
<th> Type </th>
<th> Name </th>
<th> Description </th>
</tr>
<tr>
<td> string </td>
<td> country_id </td>
<td> ID of the retrieved country </td>
</tr>
<tr>
<td> string </td>
<td> iso2_code </td>
<td> ISO 2-alpha code </td>
</tr>
<tr>
<td> string </td>
<td> iso3_code </td>
<td> ISO 3-alpha code </td>
</tr>
<tr>
<td> string </td>
<td> name </td>
<td> Name of the retrieved country </td>
</tr>
</tbody></table>


<h4><a name="directory_country.list-Examples"></a>Examples</h4>

<h5><a name="directory_country.list-RequestExampleSOAPV1"></a>Request Example SOAP V1</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy-&gt;login('apiUser', 'apiKey');
$countries = $proxy-&gt;call($sessionId, 'country.list');
var_dump($countries); // Coutries list.</pre>
		</div>
</div></div>

<h5><a name="directory_country.list-RequestExampleSOAPV2"></a>Request Example SOAP V2</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
$sessionId = $proxy-&gt;login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary

$result = $proxy-&gt;directoryCountryList($sessionId);
var_dump($result);</pre>
		</div>
</div></div>


<h5><a name="directory_country.list-RequestExampleSOAPV2%28WSIComplianceMode%29"></a>Request Example SOAP V2 (WS-I Compliance Mode)</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: php; gutter: false">$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); 

$sessionId = $proxy-&gt;login((object)array('username' =&gt; 'apiUser', 'apiKey' =&gt; 'apiKey')); 
 
$result = $proxy-&gt;directoryCountryList((object)array('sessionId' =&gt; $sessionId-&gt;result));   
var_dump($result-&gt;result);</pre>
		</div>
</div></div>

<h5><a name="directory_country.list-ResponseExampleSOAPV1"></a>Response Example SOAP V1</h5>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<div id="root">
		<pre class="theme: Default; brush: java; gutter: false">array
  0 =&gt;
    array
      'country_id' =&gt; string 'AD' (length=2)
      'iso2_code' =&gt; string 'AD' (length=2)
      'iso3_code' =&gt; string 'AND' (length=3)
      'name' =&gt; string 'Andorra' (length=7)
  1 =&gt;
    array
      'country_id' =&gt; string 'AE' (length=2)
      'iso2_code' =&gt; string 'AE' (length=2)
      'iso3_code' =&gt; string 'ARE' (length=3)
      'name' =&gt; string 'United Arab Emirates' (length=20)
  2 =&gt;
    array
      'country_id' =&gt; string 'AF' (length=2)
      'iso2_code' =&gt; string 'AF' (length=2)
      'iso3_code' =&gt; string 'AFG' (length=3)
      'name' =&gt; string 'Afghanistan' (length=11)</pre>
		</div>
</div></div>

<?php include(__ROOT__ . 'footer.php'); ?>
